import request from '@/api/request.js';

export function getGoods(){
	return new Promise((resolve, reject) =>{
		request('/goods', 'GET')
		  .then((res) => {
		    resolve(res);
		  })
		  .catch((err) => {
		    reject(err);
		  });
	})
}

export function findGoods(id){
	return new Promise((resolve, reject) =>{
		request('/goods/'+id, 'GET')
		  .then((res) => {
		    resolve(res);
		  })
		  .catch((err) => {
		    reject(err);
		  });
	})
}

export function instore(goods){
	return new Promise((resolve, reject) =>{
		request('/instore/', 'POST', goods)
		  .then((res) => {
		    resolve(res);
		  })
		  .catch((err) => {
		    reject(err);
		  });
	})
}

export function addGoods(good){
	return new Promise((resolve, reject) =>{
		request('/goods', 'POST',good)
		  .then((res) => {
		    resolve(res);
		  })
		  .catch((err) => {
		    reject(err);
		  });
	})
}